package jannex.sql.extensions;

import jannex.Jannex;
import jannex.internal.ExceptionFactory;
import jannex.sql.JxStruct;

import java.sql.SQLException;
import java.sql.Struct;
import java.util.Map;

public class StructImpl implements JxStruct {

    private Struct struct;
    private Jannex jannex;

    public StructImpl(Struct struct, Jannex jannex) {
        this.struct = struct;
        this.jannex = jannex;
    }

    @Override
    public String getSQLTypeName() {
        try {
            return struct.getSQLTypeName();
        } catch (SQLException e) {
            throw ExceptionFactory.make(e);
        }
    }

    @Override
    public Object[] getAttributes() {
        try {
            return struct.getAttributes();
        } catch (SQLException e) {
            throw ExceptionFactory.make(e);
        }
    }

    @Override
    public Object[] getAttributes(Map<String, Class<?>> map) {
        try {
            return struct.getAttributes(map);
        } catch (SQLException e) {
            throw ExceptionFactory.make(e);
        }
    }
}
